package com.ysd.lis.controller.sys;


import com.ysd.common.Result;
import com.ysd.common.dto.OrganizationDTO;
import com.ysd.lis.annotation.LogDetail;
import com.ysd.lis.aspect.OperationType;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.SysBasDict;
import com.ysd.lis.request.CommonPageDto;
import com.ysd.lis.service.SysBasDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 员工表
 * 前端控制器
 * </p>
 *
 * @author LiuQi
 * @since 2023-10-19
 */
@Api(tags = "基础字典")
@RestController
@RequestMapping("/api/sys/basDict")
public class SysBasDictController extends BaseController {

    @Autowired
    SysBasDictService sysBasDictService;
    @ApiOperation("分页查询")
    @GetMapping("/findDictPageList")
    public Result findDictPageList(CommonPageDto pageParam){
        return sysBasDictService.findDictPageList(pageParam);
    }

    @ApiOperation("查询")
    @GetMapping("/findDictList")
    public Result findDictList(CommonPageDto pageParam){
        return sysBasDictService.findDictList(pageParam);
    }
    @ApiOperation("查询")
    @GetMapping("/findDictListByType")
    public Result findDictListByType(CommonPageDto pageParam){
        return sysBasDictService.findDictListByType(pageParam);
    }

    @ApiOperation("查询字典及字典值")
    @GetMapping("/findDictAndDetailList")
    public Result findDictAndDetailList(CommonPageDto pageParam){
        return sysBasDictService.findDictAndDetailList(pageParam);
    }

    @ApiOperation("新增")
    @PostMapping("/addDict")
    @LogDetail(requestParam ="addDict",operationType = OperationType.INSERT, module = "字典设计",content = "通过字典设计模块，增加【name】字典", businessName = "name")
    public Result addDict(@RequestBody SysBasDict dict){
        return  sysBasDictService.addDict(dict);
    }

    @ApiOperation("修改")
    @PostMapping("/editDict")
    @LogDetail(requestParam ="editDict",operationType = OperationType.UPDATE, module = "字典设计",content = "通过字典设计模块，编辑【name】字典", businessName = "name")
    public Result editDict(@RequestBody SysBasDict dict) {
        return sysBasDictService.editDict(dict);
    }

    @ApiOperation("根据详情id删除详情数据")
    @PostMapping("/deleteDict")
    @LogDetail(requestParam ="deleteDict",operationType = OperationType.DELETE, module = "字典设计",content = "通过字典设计模块，删除【name】数据", businessName = "name")
    public Result deleteDict(@RequestBody SysBasDict dict) {
        return sysBasDictService.deleteDict(dict);
    }

    @ApiOperation("查询")
    @GetMapping("/findDictTypeAndDictList")
    public Result findDictTypeAndDictList(CommonPageDto pageParam){
        return sysBasDictService.findDictTypeAndDictList(pageParam);
    }

}
